<?php
// +----------------------------------------------------------------------
// | QSCMS
// +----------------------------------------------------------------------
// | Copyright (c)  2025 https://www.qqss.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed QSCMS is not free software, commercial use must purchase official license from official website to avoid unnecessary legal disputes.
// +----------------------------------------------------------------------
// | Author: Contract 990504246@qq.com
// +----------------------------------------------------------------------

namespace app\adminapi\validate\goods;

use taoser\Validate;

class SpecValidate extends Validate
{
    protected $rule = [
        'id'         => 'require|number',
        'name'       => 'require|max:255',
        'rule_value' => 'require|array',
        'status'     => 'in:0,1',
        'sort'       => 'number',
    ];

    protected $message = [
        'id.require'         => 'id_required',
        'id.number'          => 'id_number',
        'name.require'       => 'name_required',
        'name.max'           => 'name_max',
        'rule_value.require' => 'rule_value_required',
        'rule_value.array'   => 'rule_value_array',
        'status.in'          => 'status_in',
        'sort.number'        => 'sort_number',
    ];

    public function sceneEdit()
    {
        return $this->only(['id', 'name', 'rule_value', 'status', 'sort']);
    }

    public function sceneAdd()
    {
        return $this->only(['name', 'rule_value', 'status', 'sort']);
    }

    public function sceneDel()
    {
        return $this->only(['id']);
    }

    public function sceneStatus()
    {
        return $this->only(['id']);
    }

}